package demo18_CAS;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author kunkun
 * @className Test_CAS
 * @Description 测试CAS
 * @date 2025/3/8 18:44
 */
public class Test01_CAS {

    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(2021);

        //使用cas操作内存值
        atomicInteger.compareAndSet(2021,2025);
        System.out.println(atomicInteger);//2025
    }

}
